<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }

        #progress-box{
            width: 200px;
            height: 40px;    
            /* border:1px solid black; */
            /* background-color:black; */
        }

        #progress{
            height: 40px;
            background-color: red;
        }
    </style>
</head>

<body>
    <div id="app">
        <input type="button" value="走起" @click="go">
        <div id="progress-box">
            <div id="progress" :style="{width:w+'px'}"></div>
        </div>

    </div>
    <script src="./js/vue.js"></script>

    <script>
        let vm = new Vue({
            el: "#app",
            data: {
                w:0
            },
            methods:{
                go(){
                    let mytimer = setInterval(()=>{
                        this.w+=2;
                        if(this.w>=200){
                            this.w=200;
                            clearInterval(mytimer);
                        }
                    },20);
                }
            }
        })

    </script>
</body>

</html>